#include <stdio.h>
#include <stdlib.h>

#define MAXSIZE 100



int main(void)
{
    int *stack;
    int stack_top;

    // init
    stack = calloc(MAXSIZE + 1, sizeof(int));
    stack_top = 0;

    // push
    stack[++stack_top] = 100;

    for (int i = 0; i <= MAXSIZE; i++) {
        if (stack_top + 1 <= MAXSIZE) {
            stack[++stack_top] = i;
            printf("stack_top = %d value = %d\n",stack_top, i);
        }
    }

    // top
    printf("stack top = %d\n", stack[stack_top]);

    // pop
    stack_top--;

    // top
    printf("stack top = %d\n", stack[stack_top]);

    // destory
    free(stack);

    return 0;
}
